//
//  TestSafeAreaViewController.m
//  MyDemos
//
//  Created by iMac on 2018/3/15.
//  Copyright © 2018年 iMac. All rights reserved.
//

#import "TestSafeArea222ViewController.h"

@interface TestSafeArea222ViewController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation TestSafeArea222ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    
    
    if (@available(iOS 11, *)) {
//        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        

        
        CGFloat statusHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
        CGFloat navHeight = self.navigationController.navigationBar.frame.size.height;
        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways;
        self.tableView.frame = CGRectMake(0, statusHeight, SCREEN_WIDTH, SCREEN_HEIGHT - statusHeight);
//        [self.navigationController setNavigationBarHidden:YES animated:YES];
        
    } else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    
    
    
    
    
    
    [self.view addSubview:self.tableView];
    self.tableView.backgroundColor = [UIColor grayColor];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
    
}









- (void)dismissButtonClick:(UIButton *)sender {
    [self dismissViewControllerAnimated:true completion:nil];
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *cellID = @"cellID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    cell.textLabel.text = @"asgpoaslj";
    return cell;
}


@end
